try:
    from gibe.plugin import Plugin
except ImportError:
    Plugin = None

if Plugin:
    import cherrypy
    from widgets import Amatomu

    class AmatomuPlugin(Plugin):
        def __init__(self):
            self.reconfigure()

        def reconfigure(self):
            self.amatomu_blog_id = cherrypy.config.get("amatomu.blog_id", None)
            self.w = Amatomu(amatomu_blog_id = self.amatomu_blog_id)

        def blog_bottom_widgets(self, blog, wl, context):
            if self.amatomu_blog_id:
                wl.extend([self.w])
